package com.cet.designapplication.service;

import com.cet.designapplication.iterator.EsQueryCollection;
import org.springframework.stereotype.Service;

import java.util.LinkedList;
import java.util.Map;

/**
 * @author NSOC
 */
@Service
public class EsQueryService {

    public Object queryEsBySql(String querySql, Integer fetchSize) {
        EsQueryCollection esQueryCollection = new EsQueryCollection(querySql, fetchSize);
        LinkedList<Object> result = new LinkedList<>();
        for (Map<String, Object> stringObjectMap : esQueryCollection) {
            result.add(stringObjectMap);
        }
        return result;
    }
}
